<template>
  <div class="btnDetail">
    <!--<el-button type="text" size="mini" @click="dialogFormVisibleAdd = true">查看</el-button>-->
    <i class="iconfont icon-chakan" @click="dialogFormVisibleAdd = true"></i>
    <el-dialog class="dialog800" :close-on-click-modal="false" :append-to-body="true" title="企业基本信息" :visible.sync="dialogFormVisibleAdd" @opened="$store.commit('dialogTop')" >
      <div style="margin: 5px 0;">
        <el-row >
          <el-col :offset="1"  :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">企业名称：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.enterpriseName}}</span>
            </div>

          </el-col>
          <el-col :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">企业简称：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.enterpriseAlias}}</span>
            </div>
          </el-col>
          <el-col :span="7">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">企业注册号：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.societyCredit}}</span>
            </div>
          </el-col>
        </el-row>
        <el-row >
          <el-col :offset="1" :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">注册地址：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.regAddress}}</span>
            </div>

          </el-col>
          <el-col :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">注册城市：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.regCity}}</span>
            </div>
          </el-col>
          <el-col :span="7">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">注册资本：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.regCapital}}</span>
            </div>
          </el-col>
        </el-row>
        <el-row >
          <el-col :offset="1"  :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">法定代表人：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.legalName}}</span>
            </div>

          </el-col>
          <el-col :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">注册类型：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.legalType}}</span>
            </div>
          </el-col>
          <el-col :span="7">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">创建日期：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.establishDate}}</span>
            </div>
          </el-col>
        </el-row>
        <el-row >
          <el-col :offset="1" :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">注册日期：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.regDate}}</span>
            </div>

          </el-col>
          <el-col :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">联系电话：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.contactsPhone}}</span>
            </div>
          </el-col>
          <el-col :span="7">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">成立日期：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.establishDate}}</span>
            </div>
          </el-col>
        </el-row>
        <el-row >
          <el-col :offset="1" :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">办公地址：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.cityAddress}}</span>
            </div>

          </el-col>
          <el-col :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">联系电话（总部）：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.hqPhone}}</span>
            </div>
          </el-col>
          <el-col :span="7">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">举报电话：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.hqAddress}}</span>
            </div>
          </el-col>
        </el-row>
        <el-row >
          <el-col :offset="1" :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">负责人（深圳）：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.principalCity}}</span>
            </div>

          </el-col>
          <el-col :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">负责人职务：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.position}}</span>
            </div>
          </el-col>
          <el-col :span="7">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">举报电话（总部）：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.informPhone}}</span>
            </div>
          </el-col>
        </el-row>
        <el-row >
          <el-col :offset="1" :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">是否免押金：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.hasDeposit==0?"未免押":info.hasDeposit==1?"免押":""}}</span>
            </div>

          </el-col>
          <el-col :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">押金托管机构全称：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.custodianBank}}</span>
            </div>
          </el-col>
          <el-col :span="7">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">负责人联系电话：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.principalPhone}}</span>
            </div>
          </el-col>
        </el-row>
        <el-row >
          <el-col :offset="1"  :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">押金托管机构所在城市：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.custodianBankCity}}</span>
            </div>

          </el-col>
          <el-col :span="8">
            <div style="line-height: 35px;font-size:13px;">
              <span style="color:#50545D; ">押金托管机构地址：</span>
              <span style="color:#3975FE;font-weight: bold;">{{info.custodianBankAddr}}</span>
            </div>
          </el-col>
        </el-row>
      </div>
    </el-dialog>
  </div>
</template>

<script>

  export default {
    props:["info"],
    data () {
      var phoneCheck = (rule, value, callback) => {
        var phnum = /^1[3456789]{1}\d{9}$/
        if (value === '') {
          callback(new Error('联系电话不能为空'));
        }else if(!phnum.exec(Number(value))){
          callback(new Error('请正确输入手机号！'));
        } else {
          callback();
        }
      };
      var userPasswordCheck = (rule, value, callback) => {
        var pwd= /(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%\^&*?]{8,}$/;
        if (!value) {
          return callback(new Error('密码不能为空'));
        } else if(!pwd.exec(value)){
          callback(new Error('密码至少8位数并包含数字和字母'));
        } else {
          callback();

        }
      };
      return {
        options: [],
        options1: [{
          value: '1',
          label: '审核',
        },{
          value: '2',
          label: '编辑',
        },{
          value: '3',
          label: '查看',
        }],
        props: {
          value: '4',
          label: '城管局',
          children: 'items'
        },
        ruleFormAdd: {
          "unitId": "",
          "userName": "",
          "mobile": "",
          "userPassword": "",
          "position": "",
          "account": "",
          "operation": "",
          "userStatus": "1",
          "roleIds":[]
        },
        dialogFormVisibleAdd: false,
        rulesAdd: {
          mobile: [
            {validator: phoneCheck, }
          ],
          userPassword: [
            {validator: userPasswordCheck, }
          ],

        }
      }
    },
    created(){

    },
    methods: {

      //提交回调
      handleDiaSureAdd(){
        this.axios.post(process.env.API_HOST + '/systemUser/insert', {...this.ruleFormAdd})
          .then(response => {
            let result=response.data
            if (result.code == 200) {
              this.$message({
                type: 'success',
                message: '新增成功!'
              });
              this.dialogFormVisibleAdd = false
              this.$emit('getListInfo')
              this.resetForm('ruleFormAdd')
            }

          })
          .catch(error => {
            console.log(error);
          });
      },
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
//            this.handleDiaSureAdd()
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  }
</script>

<style lang="stylus" rel="stylesheet/stylus" >
  @import "../../../common/stylus/mixin.styl"
  .btnDetail
    display inline-block
  .dialog800 .el-dialog
    width 1000px !important
    font-family 'SourceHanSansCN-Medium'
    text-align left
</style>
